package com.fqgj.xjd.user.client.enums;

/**
 * Created by linchengyu on 17/3/27.
 */
public enum UserBindCardTypeEnum {

    CARD_51(1, "51card"),
    CARD_LL(2, "LLcard");

    private Integer code;
    private String type;

    UserBindCardTypeEnum(Integer code, String type) {
        this.code = code;
        this.type = type;
    }

    public Integer getCode() {
        return code;
    }

    public UserBindCardTypeEnum setCode(Integer code) {
        this.code = code;
        return this;
    }

    public String getType() {
        return type;
    }

    public UserBindCardTypeEnum setType(String type) {
        this.type = type;
        return this;
    }

    public static UserBindCardTypeEnum getEnumByType(String type) {
        UserBindCardTypeEnum userBindCardTypeEnum = null;

        for (UserBindCardTypeEnum b : UserBindCardTypeEnum.values()) {
            if (b.getType().equals(type)) {
                userBindCardTypeEnum = b;
            }
        }
        return userBindCardTypeEnum;
    }


    public static UserBindCardTypeEnum getEnumByCode(Integer code) {
        UserBindCardTypeEnum userBindCardTypeEnum = null;

        for (UserBindCardTypeEnum b : UserBindCardTypeEnum.values()) {
            if (b.getCode() == code) {
                userBindCardTypeEnum = b;
            }
        }
        return userBindCardTypeEnum;
    }

}
